[SUBROUTINE]
version = 1.14
icon = tool-change.png
name = _("Reamer Change")
type = reamer_chng
help = _("<b>Change reamer and/or settings</b>&#10;Changes setting accordingly even if disabled")
order = act h1 dnum h2 tlc spindle_dir cooling h4 feed speed h3

[PARAM_ACT]
name = _("Active")
icon = enable.png
type = bool
value = 1
tool_tip = _("Params will be set even if disabled")

[PARAM_H1]
name = _("Select reamer")
type = sub-header

[PARAM_H2]
name = _("Action")
type = sub-header

;[PARAM_H3]
;name = _("Drilling params")
;type = sub-header

[PARAM_H4]
name = _("Feed and speed")
type = sub-header

[PARAM_DNUM]
name = _("Tool number")
header = h1
type = tool
icon = tool.png
tool_tip = _("Select from tool table")
value = 0

[PARAM_TLC]
name = _("Use length comp")
icon = comp-l.png
type = combo
options = _("No=0:Already mounted and touched=3:From tool table=1:Table and probe=2")
header = h2
value = 1
tool_tip = _("Use G43 and probe if setup")

[PARAM_COOLING]
name = _("Use cooling")
header = h2
type = combo
options = _("None=9:Flood=8:Mist=7")
icon = snowflake.png
tool_tip = _("Use flood, mist or none")
value = 8

[PARAM_SPEED]
name = _("Spindle speed")
header = h4
type = int
minimum_value = 100
icon = tool-spindle.png
tool_tip = _("Set spindle speed")
value = 1000

[PARAM_SPINDLE_DIR]
name = _("Start spindle")
header = h2
type = combo
options = _("No=0:Clockwise=3:Counter-clockwise=4")
icon = spindle-start.png
tool_tip = _("Select drill rotation")
value = 3

;[PARAM_FEED]
;name = _("Feed")
;header = h4
;type = float
;icon = tool-feed.png
;tool_tip = _("Feed at 100% engagement")
;minimum_value = 0.0
;not_allowed = 0
;value = 10
;metric_value = 250

[PARAM_FEED]
name = _("Feed")
header = h4
type = float
icon = tool-vertical-feed.png
value = 8
not_allowed = 0
metric_value = 200
minimum_value = 0.0


[DEFINITIONS]
content =
;	<eval>self.include_once(file name here)</eval>

[CALL]
content =
	(begin #sub_name)
	(reamer change params and changing code author : Fernand Veilleux)
	
	#<_spindle_dir>      =  #param_spindle_dir
	#<_cooling_mode>     =  #param_cooling
	
	#<_feed_normal>      =  #param_feed
	#<_rpm_normal>       =  #param_speed
	#<_tool_usage>       =  5
	
	o<#self_id_tlc> if [[#param_tlc EQ 3] AND [#param_dnum GT 0]]
		M61 Q#param_dnum
	o<#self_id_tlc> endif
	
	o<#self_id_act> if [#param_act AND [#param_dnum NE #5400]]
		M9
		T#param_dnum M6
	o<#self_id_act> endif
	
	o<#self_id_lc> if [[#param_tlc EQ 1] OR [#param_tlc EQ 2]]
		G43 H#param_dnum
	o<#self_id_lc> endif
	
	o<#self_id_01> if [[#<_spindle_dir> GT 0] AND #<_spindle_all_time>]
		o<set_feed_rate_and_speed> CALL [1]
	o<#self_id_01> endif
	(end #sub_name)
